<?php
/**
 * Created by PhpStorm.
 * User: Yangjinlei
 * Date: 2018/7/14
 * Time: 10:07
 */

namespace App\Http\Controllers\Admin;


use App\Http\Controllers\ApiBaseController;
use App\Models\Admin;
use App\Repositories\AdminRepository;
use function foo\func;

/**
 * @property AdminRepository repository
 */
class AdminController extends ApiBaseController
{
    public function __construct(AdminRepository $repository)
    {
        $this->repository = $repository;
    }

    public function info()
    {
        $user = $this->repository->find(auth('admin')->id());
        return $this->success([
            'user_id'=>$user->id,
            'name'=>$user->name,
            'avatar'=>$user->avatar??'',
            'access'=>$this->repository->getModel()->permissions
        ]);
    }
}